enum LogLevel {
  v,
  d,
  i,
  w,
  e;

  static Map<String, LogLevel> _cacheEnumsValue = <String, LogLevel>{};

  static LogLevel fromValue(String name) {
    return _fromNullableValue(name) ?? LogLevel.d;
  }

  static LogLevel? _fromNullableValue(String name) {
    if (_cacheEnumsValue.isEmpty) {
      for (var element in LogLevel.values) {
        _cacheEnumsValue[element.name] = element;
      }
    }
    return _cacheEnumsValue[name];
  }
}
